package com.myiam.idm.meta.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Transactional;

public interface GenericJpaRepositoryInterface<T, ID extends Serializable> {

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository#countAll()
	 */
	public abstract int countAll();

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository#countByExample(java.lang.Object)
	 */
	public abstract int countByExample(final T exampleInstance);

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository#findAll()
	 */
	public abstract List<T> findAll();

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository#findByExample(java.lang.Object)
	 */
	@SuppressWarnings("unchecked")
	public abstract List<T> findByExample(final T exampleInstance);

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository#findById(java.io.Serializable)
	 */
	public abstract T findById(final ID id);

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository
	 * #findByNamedQuery(java.lang.String, java.lang.Object[])
	 */
	@SuppressWarnings("unchecked")
	public abstract List<T> findByNamedQuery(final String name,
			Object... params);

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository
	 * #findByNamedQueryAndNamedParams(java.lang.String, java.util.Map)
	 */
	@SuppressWarnings("unchecked")
	public abstract List<T> findByNamedQueryAndNamedParams(final String name,
			final Map<String, ? extends Object> params);

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository#delete(java.lang.Object)
	 */
	@Transactional
	public abstract void delete(T entity);

	/**
	 * @see be.bzbit.framework.domain.repository.GenericRepository
	 * #save(java.lang.Object)
	 */
	@Transactional
	public abstract T create(T entity);

}